package WaiBao;

import java.util.Arrays;

public class QingZeXuan {
    public static void main(String[] args) {
        String[] name = {"扁鹊(班长)", "华佗(副班长)", "小李(学习委员)", "曹操(纪律委员)", "曹孟德", "曹植", "曹爽", "曹瑞瑞", "李兴峰", "张浩宇", "李甜甜","关婷婷",
                "王理想", "李向阳", "燕双鹰", "杜马", "倪海海", "王大大", "张冲", "理想唐", "王婷", "周一寻", "陈奕迅", "李海海", "杨辉", "李凯", "李阳","王东",
                "杨清柠", "秦泽轩(生活委员)"};//考生本人:秦泽轩(生活委员)
        int[] age = {20, 21, 20, 21, 20, 22, 21, 20, 19, 19,19, 20, 19, 20, 22, 19, 19, 18, 18,20, 19, 19, 20, 20, 21, 18, 20, 19, 21, 20};//最后一位考生年龄：20岁

        double[] sushang1 = {81, 84, 84, 85, 78, 79, 78, 89, 80, 91, 94, 87, 85, 74, 75, 78, 69, 99, 96, 88, 92, 91, 95, 88, 75, 74, 78, 78, 87, 96};
        double[] sushang2 = {77, 79, 74, 88, 87, 76, 84, 75, 71, 80, 84, 78, 87, 77, 85, 65, 70, 74, 76, 68, 92, 71, 95, 81, 75, 84, 76, 97, 90, 97};
        double[] sushang3 = {78, 87, 71, 85, 71, 69, 78, 80, 81, 69, 93, 87, 85, 75, 68, 68, 69, 69, 96, 93, 92, 81, 95, 95, 79, 84, 78, 75, 71, 96};

        double shouyi1;//代表每个学生的总分
        double shouyi2;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            shouyi1 = sushang1[i] +sushang2[i] +sushang3[i];
//            shouyi2 = ( shouyi1* 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" + shouyi1);
//            System.out.println(name[i] + "的平均分为:" +shouyi2);
//        }


        double daohang1 = 0, daohang2 = 0;
        double[] jiuzhang = new double[30];
//        for (int i = 0; i < 30; i++) {
//            daohang1 = sushang1[i] + sushang2[i] +sushang3[i];
//            daohang2 = (daohang1 * 1.0) / 3;
//            jiuzhang[i] = daohang2;
//        }
//
//        for (int i = 0; i <jiuzhang.length - 1; i++) {
//            for (int j = 0; j < jiuzhang.length - i - 1; j++) {
//                if (jiuzhang[j] < jiuzhang[j + 1]) {
//                    double tep = jiuzhang[j];
//                    jiuzhang[j] = jiuzhang[j + 1];
//                    jiuzhang[j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println(jiuzhang[i]);
//        }


        double paozi1 = 0,paozi2 = 0, paozi3 = 0;//计算每门课的平均分
        double gege1 = 0, gege2 = 0, gege3 = 0;//计算每门课标准差
        double mainxie1 = 0,mainxie2 = 0,mainxie3 = 0;//计算每门课中位数
        double sum2 = 0;
        for (int i = 0; i <sushang1.length; i++) {
            sum2+=sushang1[i];
        }
        paozi1 = (sum2*1.0)/30;
        System.out.println("生物化学的班级平均分为:"+paozi1);
        double Sum = 0;
        for (int i = 0; i <sushang2.length; i++) {
            Sum+=sushang2[i];
        }
        paozi2 = (Sum*1.0)/30;
        System.out.println("微生物学的班级平均分为:"+paozi2);
        double sum = 0;
        for (int i = 0; i <sushang3.length; i++) {
            sum+=sushang3[i];
        }
        paozi3 = (sum*1.0)/30;
        System.out.println("人体组织解剖学的班级平均分为:"+paozi3);



        double c1 = 0,c2 = 0,c3 = 0;
        for (int i = 0; i <sushang1.length; i++) {
            c1+= (sushang1[i] -paozi1)*(sushang1[i] -paozi1);
        }
        gege1 = Math.sqrt(c1*1.0/30);
        System.out.println("生物化学的班级标准差为:"+gege1);

        for (int i = 0; i < sushang2.length; i++) {
            c2+= (sushang2[i] -paozi2)*(sushang2[i] - paozi2);
        }
        gege2 = Math.sqrt(c2*1.0/30);
        System.out.println("微生物学的班级标准差为:"+gege2);

        for (int i = 0; i < sushang3.length; i++) {
            c3+= (sushang3[i] -paozi3)*(sushang3[i] - paozi3);
        }
        gege3 = Math.sqrt(c3*1.0/30);
        System.out.println("人体组织解剖学的班级标准差为:"+gege3);
////////////
////////////
        Arrays.sort(sushang1);
        Arrays.sort(sushang2);
        Arrays.sort(sushang3);
        mainxie1 =(sushang1[14]+sushang1[15])*1.0/2;
        mainxie2 =(sushang2[14]+sushang2[15])*1.0/2;
        mainxie3 =(sushang3[14]+sushang3[15])*1.0/2;
        System.out.println("生物化学的中位数为:"+mainxie1);
        System.out.println("微生物学的中位数为:"+mainxie2);
        System.out.println("人体组织解剖学的中位数为:"+mainxie3);





    }
}
